package com.aiatomic.couting.util;

import android.content.Context;

import java.io.IOException;
import java.io.InputStream;
import java.security.KeyStore;
import java.security.SecureRandom;
import java.security.cert.CertificateFactory;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;

import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;

import okhttp3.Interceptor;
import okhttp3.OkHttpClient;

/**
 * Created by wengui on 2016/10/11.
 */

public final class OKHttpUtil {
    private OkHttpClient okHttpClient;

    private static class Holder {
        static OKHttpUtil util = new OKHttpUtil();
    }

    public static OKHttpUtil getUtil() {
        return Holder.util;
    }

    private OKHttpUtil() {
        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        builder .retryOnConnectionFailure(true);
        okHttpClient = builder.connectTimeout(600, TimeUnit.SECONDS).readTimeout(600, TimeUnit.SECONDS).writeTimeout(600, TimeUnit.SECONDS)
                .build();
    }

    public OkHttpClient getOkHttpClient() {
        return okHttpClient;
    }
}
